export const throttle = (fn, delay = 500) => {
  let timer
  return function (index: any | null) {
    if (timer) {
      clearTimeout(timer)
      timer = null
    }
    timer = setTimeout(() => {
      fn(index)
    }, delay)
  }
}
